/******************************************************************************
 * @section DESCRIPTION
 *
 * This subroutine frees all components of the veg_con structure.
 *
 * @section LICENSE
 *
 * The Variable Infiltration Capacity (VIC) macroscale hydrological model
 * Copyright (C) 2016 The Computational Hydrology Group, Department of Civil
 * and Environmental Engineering, University of Washington.
 *
 * The VIC model is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *****************************************************************************/

#include <vic_driver_shared_all.h>

/******************************************************************************
 * @brief    This subroutine frees all components of the veg_con structure.
 *****************************************************************************/
void
free_vegcon(veg_con_struct **veg_con)
{
    extern option_struct options;
    size_t               i;

    for (i = 0; i < veg_con[0][0].vegetat_type_num; i++) {
        free((char *) veg_con[0][i].zone_depth);
        free((char *) veg_con[0][i].zone_fract);
        if (options.CARBON) {
            free((char *) veg_con[0][i].CanopLayerBnd);
        }
    }
    free((char *) veg_con[0]);
}
